<template>
  	<el-row >
	  	<el-col :xs="3" :md="1">
	  		<img src="../../assets/qmlogo.png" class="mt10 pointer" width="32" height="32"
	  		@click="logo"
	  		>
	  	</el-col>

	  	<el-col :xs="18" :md="4">
	  		<div class="mt15 h2" >{{userInfo.company_name}}</div>
	  	</el-col>

	  	<el-col class="hidden-xs-only" :md="16">
&nbsp;
	  	</el-col>

	  	<el-col :xs="3" :md="3" >

	  		<el-form :inline="true" class="mt10 text-right" >
	  			<!-- <el-form-item>
				  	<el-dropdown class=" pointer">
					  <span class="el-dropdown-link">
					    {{systemName}}<i class="el-icon-arrow-down el-icon--right"></i>
					  </span>
					  <el-dropdown-menu slot="dropdown">
					    <el-dropdown-item
					    v-for="item in systemList"
					    @click.native="chooseSystem(item)"
					    >{{item.name}}</el-dropdown-item>
					  </el-dropdown-menu>
					</el-dropdown>
			  	</el-form-item> -->
				<el-form-item>
					<div class=" pointer red"
					@click="logout"
					>
						<i class="el-icon-error"></i>
					</div>
				</el-form-item>
			</el-form>

			

			<!-- <div class="mt20 pointer red"
	  		@click="logout"
	  		><i class="el-icon-error"></i></div> -->
	  	</el-col>

	  	<!-- <el-col :span="1" class="text-right">
	  		<div class="mt20 pointer red"
	  		@click="logout"
	  		><i class="el-icon-error"></i></div>
	  	</el-col> -->

	</el-row>

</template>

<script>

import { mapGetters } from 'vuex'
import { logout } from '../../service/api'


export default {
	name: 'header1',
		data () {
		return {
		}
	},

	components: {
		
	},

	computed : {
		...mapGetters([
			'userInfo',
	        'systemList', 
	        'systemName',
	    ]),
	},

	methods : {
		chooseSystem(item) {
	        this.$store.dispatch('getMenuList', {'id' : item.id});
	    },

	    logout () {
			// let res = await logout();
			// if(res.errcode == 0){
			// 	this.$router.push({ 
			// 		name: 'login', 
			// 	});
			// }

			const para = {
				fun : 'logout',
				//requestType : 'get',
				cb : res => {
					this.$router.push({ 
						name: 'login', 
					});
				}
			};

			this.$store.dispatch('update', para);
		},

		logo () {
			this.$router.push({ 
				name: 'dashboard', 
			});
		}
	},

	watch:{
	    
	},

	mounted () {
		
	},

}
</script>

<style scoped>

</style>
